home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / emacssrc.zip / EMACSSRC.TAR / emacs-19.17 / lib-src / vcdiff < prev    next >
Text File  |  1993-11-16  |  1KB  |  90 lines

  1. #!/bin/sh
  2. #
  3. # Enhanced sccs diff utility for use with vc mode.
  4. # This version is more compatible with rcsdiff(1).
  5. #
  6. #    $Id: vcdiff,v 1.2 1993/06/30 18:54:08 eggert Exp $
  7. #
  8.  
  9. DIFF="diff"
  10. usage="$0: Usage: vcdiff [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..."
  11.  
  12. echo=
  13. sid1=-r sid2=
  14.  
  15. for f
  16. do
  17.     case $f in
  18.     -*)
  19.         case $f in
  20.         -q)
  21.             echo=:;;
  22.         -r?*)
  23.             case $sid1 in
  24.             -r)
  25.                 sid1=$f
  26.                 ;;
  27.             *)
  28.                 case $sid2 in
  29.                 ?*) echo "$usage" >&2; exit 2 ;;
  30.                 esac
  31.                 sid2=$f
  32.                 ;;
  33.             esac
  34.             ;;
  35.         *)
  36.             options="$options $f"
  37.             ;;
  38.         esac
  39.         shift
  40.         ;;
  41.     *)
  42.         break
  43.         ;;
  44.     esac
  45. done
  46.  
  47. case $# in
  48. 0)
  49.     echo "$usage" >&2
  50.     exit 2
  51. esac
  52.  
  53.  
  54. rev1= rev2= status=0
  55. trap 'status=2; exit' 1 2 13 15
  56. trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0
  57.  
  58. for f
  59. do
  60.     s=2
  61.  
  62.     case $f in
  63.     s.* | */s.*)
  64.         if
  65.             rev1=/tmp/geta$$
  66.             get -s -p -k $sid1 "$f" > $rev1 &&
  67.             case $sid2 in
  68.             '')
  69.                 workfile=`expr " /$f" : '.*/s.\(.*\)'`
  70.                 ;;
  71.             *)
  72.                 rev2=/tmp/getb$$
  73.                 get -s -p -k $sid2 "$f" > $rev2
  74.                 workfile=$rev2
  75.             esac
  76.         then
  77.             $echo $DIFF $options $sid1 $sid2 $workfile >&2
  78.             $DIFF $options $rev1 $workfile
  79.             s=$?
  80.         fi
  81.         ;;
  82.     *)
  83.         echo "$0: $f is not an SCCS file" >&2
  84.     esac
  85.  
  86.     if test $status -lt $s
  87.     then status=$s
  88.     fi
  89. done
  90.